package com.yt.server.messaging;

import java.io.Serializable;
import java.util.Date;

public class Header implements Constants,Cloneable,Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3347036171493522735L;

	private String user_agent; //服务器版本
	
	private String clientId; //请求的用户ID
	
	private Date date; //时间
	
	private long dataSize; //数据长度 
	
	private byte dataType; //数据类型
	
	private String checkSum;//数据校验码

	public String getUser_agent() {
		return user_agent;
	}

	public void setUser_agent(String user_agent) {
		this.user_agent = user_agent;
	}

	public String getClientId() {
		return clientId;
	}

	public void setClientId(String clientId) {
		this.clientId = clientId;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public long getDataSize() {
		return dataSize;
	}

	public void setDataSize(long dataSize) {
		this.dataSize = dataSize;
	}

	public byte getDataType() {
		return dataType;
	}

	public void setDataType(byte dataType) {
		this.dataType = dataType;
	}

	public String getCheckSum() {
		return checkSum;
	}

	public void setCheckSum(String checkSum) {
		this.checkSum = checkSum;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((checkSum == null) ? 0 : checkSum.hashCode());
		result = prime * result
				+ ((clientId == null) ? 0 : clientId.hashCode());
		result = prime * result + (int) (dataSize ^ (dataSize >>> 32));
		result = prime * result + dataType;
		result = prime * result + ((date == null) ? 0 : date.hashCode());
		result = prime * result
				+ ((user_agent == null) ? 0 : user_agent.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Header other = (Header) obj;
		if (checkSum == null) {
			if (other.checkSum != null)
				return false;
		} else if (!checkSum.equals(other.checkSum))
			return false;
		if (clientId == null) {
			if (other.clientId != null)
				return false;
		} else if (!clientId.equals(other.clientId))
			return false;
		if (dataSize != other.dataSize)
			return false;
		if (dataType != other.dataType)
			return false;
		if (date == null) {
			if (other.date != null)
				return false;
		} else if (!date.equals(other.date))
			return false;
		if (user_agent == null) {
			if (other.user_agent != null)
				return false;
		} else if (!user_agent.equals(other.user_agent))
			return false;
		return true;
	}
}